
<legend>
    <h4><?php
        echo $control->getAjaxLink(array('name' => '功能列表', 'id' => 'showEventList'), array(
            'cooker' => 'BAEvent@showEventList'
        ));
        ?>\
        <?php
        echo $control->getAjaxLink('管理角色', array(
            'cooker' => 'BAEvent@showEventHome'
        ));
        ?>\
        <?php
        echo $control->getAjaxLink('机构角色', array(
            'cooker' => 'BARoleCooker@showSpaceRoleList'
        ));
        ?>\
        角色功能列表
    </h4>
</legend>
<div class="">
    <div class="roleList">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>功能名称</th>
                    <th>所属角色</th>
                    <th>所属应用</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <?php
                $eventCooker = new BAEventCooker();
                foreach ($roleEventList as $id => $list) {
                    $listData = $list->getItemsInArray();
                    $eventId = $listData['eventId'];
                    $event = $eventCooker->getEvent($eventId);
                    $eventData = $event->getItemsInArray();
                    $roleId = $listData['roleId'];
                    $role = new BRole($roleId);
                    $appId = $event->appId;
                    $app = BApp::getAppById($appId);
                    $appClass = get_class($app);
                    $fullName = $role->getFullName();
                    $roleAlias = BARoleCooker::getRoleAliasByFullName($fullName);
                    ?>
                    <tr>
                        <td><?php echo $eventData['alias']; ?></td>
                        <td><?php echo $roleAlias; ?></td>
                        <td><?php echo yii::t('site', $appClass); ?></td>
                        <td><?php
                            echo $control->getAjaxLink('删除', array(
                                'cooker' => 'BARoleCooker@deleteRoleEvent',
                                'roleEventId' => $id,
                                'htmlOptions' => array(
                                    'class' => ''
                            )));
                            ?> </td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
    <div>
        <?php
        echo $control->getAjaxLink('添加功能', array(
            'cooker' => 'BARoleCooker@showAddRoleEvent',
            'htmlOptions' => array(
                'class' => 'btn'
        )));
        ?>
    </div>
</div>